package Cn.Sarkar.MMS.Entities.Independent

import Cn.Sarkar.Entities.Common.Additional.IDescription
import Cn.Sarkar.Entities.Common.Additional.IName
import Cn.Sarkar.Entities.Common.Independent.IApplicationDomain
import Cn.Sarkar.Entities.MMS.Independent.IAccount
import Cn.Sarkar.Entities.MMS.Independent.IApplication
import Cn.Sarkar.Entities.MMS.Independent.ICompany
import Cn.Sarkar.Entities.MMS.Independent.Wallet.IMemberShipLevel
import Cn.Sarkar.Entities.MMS.Independent.Wallet.IWallet
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasOne
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.IDataContext
import Cn.Sarkar.MMS.DataBaseDefinations.Independent.ApplicationDomains
import Cn.Sarkar.MMS.Entities.Additional.Description
import Cn.Sarkar.MMS.Entities.Additional.Name
import Cn.Sarkar.Entities.Common.BaseEntity
import Cn.Sarkar.MMS.Entities.Independent.Wallet.MemberShipLevel
import java.util.*

class ApplicationDomain(DataContext: IDataContext) : BaseEntity(DataContext, ApplicationDomains), IApplicationDomain {
    var companyID by ApplicationDomains.CompanyID
    override var company: ICompany by hasOne(ApplicationDomains.CompanyID) { Company(it) }
    override var appKey: String by ApplicationDomains.AppKey
    override var companys: MutableList<ICompany> = LinkedList()
    override var description: IDescription by hasOne(ApplicationDomains.DescriptionID) { Description(it) }
    override var accounts: MutableList<IAccount> = LinkedList()
    override var wallets: MutableCollection<IWallet> = LinkedList()
    override var defaultMemberShipLevel: IMemberShipLevel by hasOne(ApplicationDomains.DefaultMemberShipLevelID) { MemberShipLevel(it) }
    override val memberShipLevels: MutableCollection<IMemberShipLevel> = LinkedList()
    var nameID by ApplicationDomains.NameID
    override var name: IName by hasOne(ApplicationDomains.NameID) { Name(it) }
}